﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    
    class Program
    {
    static ArrayList list = new ArrayList();
    static double sum = 0;

        static void Main(string[] args)
        {
            Text();
        }


        public static void Text() { 
            try
            {
                while (true)
                {
                    
                    Console.WriteLine("请输入选择");
                    int key = int.Parse(Console.ReadLine());
                    switch (key)
                    {
                        case 1:
                         Console.WriteLine("请输入成绩");
                         double a = double.Parse(Console.ReadLine());
                         Console.WriteLine(a);
                         list.Add(a);
                         sum += a;
                            break;
                        case 2:
                            Console.WriteLine(sum/list.Count);
                            Console.WriteLine(sum);
                            Console.WriteLine(list.Count);
                            break;
                        default:
                            break;
                    }
                

                }
               
                   
            }
            catch (FormatException e)
            {
                Console.WriteLine("异常已处理");

            }
            catch (OverflowException e)
            {
                Console.WriteLine("异常已处理");
            }

            catch (Exception e)
            {
                Console.WriteLine("异常已处理");
            }
            finally
            {
                Console.WriteLine("最终处理完释放资源");
            }  


            Console.ReadKey();
        }
        
        
    }
}
